package roborally;

import be.kuleuven.cs.som.annotate.*;

/**
 * @author Jef Keijers/Bachelor of Science: Informatics
 * @version 1.0
 */
@Value
public class Energy {
		
	public Energy(double initialEnergy,Unit unit) {
		this.setValue(initialEnergy*unit.getWeight());
		// De energy wordt intern altijd in Ws (=J) opgeslagen!
	}
	
	public Energy(double energy) {
		this(energy,Unit.Ws);
	}
	
	public double getValue() {
		return getValue(Unit.Ws);
	}
	
	public double getValue(Unit unit) {
		return energy/unit.getWeight();
	}
	
	public void setValue(double newEnergy) {
		this.energy=newEnergy;
	}	
	
	private double energy=0;
	
}
